<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ContentModelRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * validation  验证  确认 校验
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title'=>'required',
        ];
    }

    //上面是验证规则,当不符合上面定义的验证规则的时候系统会自动给页面返回错误信息
    //也可以自定义返回的提示信息
    function messages()
    {
        return [
            'title.required'=>'标题怎么能为空哪?',
        ];
    }
}

